/*
 * @Author: hwd heweidong@proya.com
 * @Date: 2024-12-11 15:00:29
 * @LastEditors: hwd heweidong@proya.com
 * @LastEditTime: 2024-12-18 14:27:29
 * @FilePath: \my-home\vite.config.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'

const url = 'https://hwdtop.online/'
// const url = "http://localhost:3001/"; //本地
export default defineConfig({
    base:'./',
    plugins: [vue(), vueJsx()],
    resolve: {
        alias: {
            '@': fileURLToPath(new URL('./src', import.meta.url))
        }
    },
    server: {
        port: 5173,
        host: "0.0.0.0",
        open: true,
        proxy: {
            '/api/': {
                target: url,
                secure:false,
                changeOrigin: true,
                rewrite: path => path.replace(/^\/api/, 'api'),//远程
                // rewrite: path => path.replace(/^\/api/, '')//本地
            
            },
        }
    }
})
